
import NetConfig from "../NetConfig"
import WebSocketService from "./WebSocketService"
import WXSocketService from "./WXSocketService"
import WebHttpService from "./WebHttpService";
import LocalService from "./LocalService";
export default class ServiceBuilder {
    static getService(messageType){
        let service = null;
        switch(messageType){
            case NetConfig.HTTP:
                service = new WebHttpService();
            break;
            case NetConfig.WEB_SOCKET:
                if (cc.sys.platform === cc.sys.WECHAT_GAME) {
                    service = new WXSocketService();
                }else{
                    service = new WebSocketService(); 
                }
                
            break;
            case NetConfig.LOCAL:
                service = new LocalService()
            break;
            default:
            break;
        }   
        return service;    
    }
}
